Nuhman Paramban


@Nuhman Paramban

check permutation

check permiutation
public static int checkPermutation(int[] nums){
Set<Integer> mySet = Arrays.stream(nums)
.boxed()
.collect(Collectors.toSet());
for(int i=0; i<nums.length;i++){
if(!mySet.contains(i+1)){
return 0;
}
}

return 1;
}